package com.batch.tasklet;

import org.springframework.batch.core.StepContribution;
import org.springframework.batch.core.scope.context.ChunkContext;
import org.springframework.batch.core.step.tasklet.Tasklet;
import org.springframework.batch.repeat.RepeatStatus;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

@Component
public class GeneralTasklet {

    @Bean
    public Tasklet tasklet01() {
        return new Tasklet() {
            @Override
            public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
                System.out.println("hello world! GeneralTasklet01");
                return RepeatStatus.FINISHED;
            }
        };


    }

    @Bean
    public Tasklet tasklet02() {
        return (StepContribution contribution, ChunkContext chunkContext) -> {
            System.out.println("hello world! GeneralTasklet02");
            return RepeatStatus.FINISHED;
        };

    }

    @Bean
    public Tasklet tasklet03() {
        return (StepContribution contribution, ChunkContext chunkContext) -> {
            System.out.println("hello world! GeneralTasklet03");
            return RepeatStatus.FINISHED;
        };

    }


}
